class CheckoutsController < ApplicationController
  # GET /checkouts
  # GET /checkouts.xml
  def index
    @checkouts = Checkout.find(:all)

    respond_to do |format|
      format.html # index.rhtml
      format.xml  { render :xml => @checkouts.to_xml }
    end
  end

  # GET /checkouts/1
  # GET /checkouts/1.xml
  def show
    @checkout = Checkout.find(params[:id])

    respond_to do |format|
      format.html # show.rhtml
      format.xml  { render :xml => @checkout.to_xml }
    end
  end

  # GET /checkouts/new
  def new
    @checkout = Checkout.new
  end

  # GET /checkouts/1;edit
  def edit
    @checkout = Checkout.find(params[:id])
  end

  # POST /checkouts
  # POST /checkouts.xml
  def create
    @checkout = Checkout.new(params[:checkout])

    respond_to do |format|
      if @checkout.save
        flash[:notice] = 'Checkout was successfully created.'
        format.html { redirect_to checkout_url(@checkout) }
        format.xml  { head :created, :location => checkout_url(@checkout) }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @checkout.errors.to_xml }
      end
    end
  end

  # PUT /checkouts/1
  # PUT /checkouts/1.xml
  def update
    @checkout = Checkout.find(params[:id])

    respond_to do |format|
      if @checkout.update_attributes(params[:checkout])
        flash[:notice] = 'Checkout was successfully updated.'
        format.html { redirect_to checkout_url(@checkout) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @checkout.errors.to_xml }
      end
    end
  end

  # DELETE /checkouts/1
  # DELETE /checkouts/1.xml
  def destroy
    @checkout = Checkout.find(params[:id])
    @checkout.destroy

    respond_to do |format|
      format.html { redirect_to checkouts_url }
      format.xml  { head :ok }
    end
  end
end
